Kinetis SDK API Reference Manual  1.0.0-beta
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

The section describes the programming interface of the SMC HAL driver. More...

Data Structures

struct  smc_power_mode_protection_config_t
 Power mode protection configuration. More...
 

Enumerations

enum  power_mode_stat_t {
  kStatRun = 0x01,
  kStatStop = 0x02,
  kStatVlpr = 0x04,
  kStatVlpw = 0x08,
  kStatVlps = 0x10,
  kStatLls = 0x20,
  kStatVlls = 0x40,
  kStatHsrun = 0x80
}
 Power Modes in PMSTAT. More...
 
enum  power_modes_protect_t {
  kAllowHsrun,
  kAllowVlp,
  kAllowLls,
  kAllowVlls,
  kAllowMax
}
 Power Modes Protection. More...
 
enum  smc_run_mode_t {
  kSmcRun,
  kSmcReservedRun,
  kSmcVlpr,
  kSmcHsrun
}
 Run mode definition. More...
 
enum  smc_stop_mode_t {
  kSmcStop,
  kSmcReservedStop1,
  kSmcVlps,
  kSmcLls,
  kSmcVlls
}
 Stop mode definition. More...
 
enum  smc_stop_submode_t {
  kSmcStopSub0,
  kSmcStopSub1,
  kSmcStopSub2,
  kSmcStopSub3
}
 VLLS/LLS stop sub mode definition.
 
enum  smc_lpwui_option_t {
  kSmcLpwuiEnabled,
  kSmcLpwuiDisabled
}
 Low Power Wake Up on Interrupt option. More...
 
enum  smc_pstop_option_t {
  kSmcPstopStop,
  kSmcPstopStop1,
  kSmcPstopStop2,
  kSmcPstopReserved
}
 Partial STOP option. More...
 
enum  smc_por_option_t {
  kSmcPorEnabled,
  kSmcPorDisabled
}
 POR option. More...
 
enum  smc_lpo_option_t {
  kSmcLpoEnabled,
  kSmcLpoDisabled
}
 LPO power option. More...
 
enum  smc_power_options_t {
  kSmcOptionLpwui,
  kSmcOptionPropo
}
 Power mode control options. More...
 

System mode controller APIs

void smc_hal_config_power_mode_protection (smc_power_mode_protection_config_t *protectConfig)
 Configures all power mode protection settings. More...
 
void smc_hal_set_power_mode_protection (power_modes_protect_t protect, bool allow)
 Configures the individual power mode protection settings. More...
 
bool smc_hal_get_power_mode_protection (power_modes_protect_t protect)
 Gets the the current power mode protection setting. More...
 
void smc_hal_power_mode_config_run (smc_run_mode_t runMode)
 Configures the the RUN mode control setting. More...
 
smc_run_mode_t smc_hal_power_mode_get_run_config (void)
 Gets the current RUN mode configuration setting. More...
 
void smc_hal_power_mode_config_stop (smc_stop_mode_t stopMode)
 Configures the STOP mode control setting. More...
 
smc_stop_mode_t smc_hal_power_mode_get_stop_config (void)
 Gets the current STOP mode control settings. More...
 
void smc_hal_power_mode_config_stop_submode (smc_stop_submode_t stopSubMode)
 Configures the stop sub mode control setting. More...
 
smc_stop_submode_t smc_hal_power_mode_get_stop_submode_config (void)
 Gets the current stop submode configuration settings. More...
 
uint8_t smc_hal_get_power_mode_stat (void)
 Gets the current power mode stat. More...
 

SMC Hal Driver

Overview

The System Mode Controller (SMC) sequences the system in and out of all low-power stop and run modes.Specifically, it monitors events to trigger transitions between the power modes while controlling the power, clocks, and memories of the system to achieve the power consumption and functionality of that mode.

Control register access APIs

  • Power mode configurations register access
  • VLLS mode configurations register access
  • Power Mode Status access
This is an example of the SMC HAL access APIs.

#include "fsl_smc_hal.h"
// Enable the clock gate for specific module. (SMC_PMCTL)
uint32_t *pmctrl = HW_SMC_PMCTRL_ADDR; // System Mode Power Control config register address
uint32_t mask = SMC_PMCTRL_RUNM_MASK; // Run mode bit mask
uint32_t shift = SMC_PMCTRL_RUNM_SHIFT; // Run mode bit shift
uint32_t settings = 0x2; // Set to Very Low Power Run mode (VLPR)
// calling smc control API to enable the clock
smc_hal_config_power_mode(pmctrl, mask, shift, settings);

Data Structure Documentation

struct smc_power_mode_protection_config_t

Data Fields

bool vlpProt
 VLP protect.
 
bool llsProt
 LLS protect.
 
bool vllsProt
 VLLS protect.
 

Enumeration Type Documentation

Enumerator
kStatRun 

0000_0001 - Current power mode is RUN

kStatStop 

0000_0010 - Current power mode is STOP

kStatVlpr 

0000_0100 - Current power mode is VLPR

kStatVlpw 

0000_1000 - Current power mode is VLPW

kStatVlps 

0001_0000 - Current power mode is VLPS

kStatLls 

0010_0000 - Current power mode is LLS

kStatVlls 

0100_0000 - Current power mode is VLLS

kStatHsrun 

1000_0000 - Current power mode is HSRUN

Enumerator
kAllowHsrun 

Allow High Speed Run mode.

kAllowVlp 

Allow Very-Low-Power Modes.

kAllowLls 

Allow Low-Leakage Stop Mode.

kAllowVlls 

Allow Very-Low-Leakage Stop Mode.

Enumerator
kSmcRun 

normal RUN mode

kSmcVlpr 

Very-Low-Power RUN mode.

kSmcHsrun 

High Speed Run mode (HSRUN)

Enumerator
kSmcStop 

Normal STOP mode.

kSmcReservedStop1 

Reserved.

kSmcVlps 

Very-Low-Power STOP mode.

kSmcLls 

Low-Leakage Stop mode.

kSmcVlls 

Very-Low-Leakage Stop mode.

Enumerator
kSmcLpwuiEnabled 

Low Power Wake Up on Interrupt enabled.

kSmcLpwuiDisabled 

Low Power Wake Up on Interrupt disabled.

Enumerator
kSmcPstopStop 

STOP - Normal Stop mode.

kSmcPstopStop1 

Partial Stop with both system and bus clocks disabled.

kSmcPstopStop2 

Partial Stop with system clock disabled and bus clock enabled.

Enumerator
kSmcPorEnabled 

POR detect circuit is enabled in VLLS0.

kSmcPorDisabled 

POR detect circuit is disabled in VLLS0.

Enumerator
kSmcLpoEnabled 

LPO clock is enabled in LLS/VLLSx.

kSmcLpoDisabled 

LPO clock is disabled in LLS/VLLSx.

Enumerator
kSmcOptionLpwui 

Low Power Wake Up on Interrupt.

kSmcOptionPropo 

POR option.

Function Documentation

void smc_hal_config_power_mode_protection ( smc_power_mode_protection_config_t protectConfig)

This function configures the power mode protection settings for supported power modes in the specified chip family. The available power modes are defined in the smc_power_mode_protection_config_t. An application should provide the protect settings for all supported power modes on the chip. This should be done at an early system level initialization stage. See the reference manual for details. This register can only write once after the power reset. If the user has only a single option to set, either use this function or use the individual set function.

Parameters
protectConfigConfigurations for the supported power mode protect settings
void smc_hal_set_power_mode_protection ( power_modes_protect_t  protect,
bool  allow 
)

This function only configures the power mode protection settings for a specified power mode on the specified chip family. The available power modes are defined in the smc_power_mode_protection_config_t. See the reference manual for details. This register can only write once after the power reset.

Parameters
protectPower mode to set for protection
allowAllow or not allow the power mode protection
bool smc_hal_get_power_mode_protection ( power_modes_protect_t  protect)

This function gets the current power mode protection settings for a specified power mode.

Parameters
protectPower mode to set for protection
Returns
state Status of the protection setting
  • true: Allowed
  • false: Not allowed
void smc_hal_power_mode_config_run ( smc_run_mode_t  runMode)

This function sets the run mode settings, for example, normal run mode, very lower power run mode, etc. See the smc_run_mode_t for supported run mode on the chip family and the reference manual for details about the run mode.

Parameters
runModeRun mode setting defined in smc_run_mode_t
smc_run_mode_t smc_hal_power_mode_get_run_config ( void  )

This function gets the run mode settings. See the smc_run_mode_t for a supported run mode on the chip family and the reference manual for details about the run mode.

Returns
setting Run mode configuration setting
void smc_hal_power_mode_config_stop ( smc_stop_mode_t  stopMode)

This function sets the stop mode settings, for example, normal stop mode, very lower power stop mode, etc. See the smc_stop_mode_t for supported stop mode on the chip family and the reference manual for details about the stop mode.

Parameters
stopModeStop mode defined in smc_stop_mode_t
smc_stop_mode_t smc_hal_power_mode_get_stop_config ( void  )

This function gets the stop mode settings, for example, normal stop mode, very lower power stop mode, etc. See the smc_stop_mode_t for supported stop mode on the chip family and the reference manual for details about the stop mode.

Returns
setting Current stop mode configuration setting
void smc_hal_power_mode_config_stop_submode ( smc_stop_submode_t  stopSubMode)

This function sets the stop submode settings. Some of the stop mode further supports submodes. See the smc_stop_submode_t for supported stop submodes and the reference manual for details about the submodes for a specific stop mode.

Parameters
stopSubModeStop submode setting defined in smc_stop_submode_t
Returns
none
smc_stop_submode_t smc_hal_power_mode_get_stop_submode_config ( void  )

This function gets the stop submode settings. Some of the stop mode further support submodes. See the smc_stop_submode_t for supported stop submodes and the reference manual for details about the submode for a specific stop mode.

Returns
setting Current stop submode setting
uint8_t smc_hal_get_power_mode_stat ( void  )

This function returns the current power mode stat. Once application switches the power mode, it should always check the stat to check whether it runs into the specified mode or not. An application should check this mode before switching to a different mode. The system requires that only certain modes can switch to other specific modes. See the reference manual for details and the _power_mode_stat for information about the power stat.

Returns
stat Current power mode stat